package com.huike.game.Activity;

import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.FragmentTransaction;

import com.huike.game.R;
import com.huike.game.fragment.Game22_person;
import com.huike.game.fragment.Game22_recharge;
import com.huike.game.fragment.Game22_set;

public class GameActivity22 extends AppCompatActivity implements View.OnClickListener {
    Context context ;


    private ImageView iv_left_image;
    private TextView tv_left_text;
    private TextView tv_content_title;
    private ImageView iv_rigth_image;
    private TextView tv_right_text;
    private TextView tv_game22_person;
    private LinearLayout ll_game22_person;
    private TextView tv_game22_recharge;
    private LinearLayout ll_game22_recharge;
    private TextView tv_game22_set;
    private LinearLayout ll_game22_set;
    private FrameLayout fl_game22;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        context=getApplicationContext();

        setContentView(R.layout.activity_game22);
        initView();


        ll_game22_person.setOnClickListener(this);
        ll_game22_recharge.setOnClickListener(this);
        ll_game22_set.setOnClickListener(this);

//        碎片
        FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
        transaction.replace(R.id.fl_game22,new Game22_person()).commit();


    }



    private void initView() {
        iv_left_image = (ImageView) findViewById(R.id.iv_left_image);
        tv_left_text = (TextView) findViewById(R.id.tv_left_text);
        tv_content_title = (TextView) findViewById(R.id.tv_content_title);
        iv_rigth_image = (ImageView) findViewById(R.id.iv_rigth_image);
        tv_right_text = (TextView) findViewById(R.id.tv_right_text);


        iv_rigth_image.setVisibility(View.GONE);
        tv_right_text.setVisibility(View.GONE);

        tv_content_title.setText("个人中心");

        tv_left_text.setVisibility(View.GONE);

        iv_left_image.setImageResource(R.drawable.tiao);

        tv_game22_person = (TextView) findViewById(R.id.tv_game22_person);
        ll_game22_person = (LinearLayout) findViewById(R.id.ll_game22_person);
        tv_game22_recharge = (TextView) findViewById(R.id.tv_game22_recharge);
        ll_game22_recharge = (LinearLayout) findViewById(R.id.ll_game22_recharge);
        tv_game22_set = (TextView) findViewById(R.id.tv_game22_set);
        ll_game22_set = (LinearLayout) findViewById(R.id.ll_game22_set);
        fl_game22 = (FrameLayout) findViewById(R.id.fl_game22);

    }

    @Override
    public void onClick(View view) {

        if(view == ll_game22_person){
            tv_game22_person.setVisibility(View.VISIBLE);
            tv_game22_set.setVisibility(View.GONE);
            tv_game22_recharge.setVisibility(View.GONE);
//            替换页面

            FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
            transaction.replace(R.id.fl_game22,new Game22_person()).commit();

        }else if(view == ll_game22_recharge){
            tv_game22_person.setVisibility(View.GONE);
            tv_game22_set.setVisibility(View.GONE);
            tv_game22_recharge.setVisibility(View.VISIBLE);

            FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
            transaction.replace(R.id.fl_game22,new Game22_recharge()).commit();

        }else if(view == ll_game22_set){
            tv_game22_person.setVisibility(View.GONE);
            tv_game22_set.setVisibility(View.VISIBLE);
            tv_game22_recharge.setVisibility(View.GONE);

            FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
            transaction.replace(R.id.fl_game22,new Game22_set()).commit();

        }

    }
}
